<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="UTF-8">
    <th:block th:include="include :: header('企业信息详情')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-corp-add">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">企业名称：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="deptName" id="deptName" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">统一社会信用代码：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="tyshxydm" id="tyshxydm" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">发码机构统一分发的企业码：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="corpCode" id="corpCode" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea id="remark" name="remark" class="form-control"></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
    var prefix = "/base";

    $("#form-corp-add").validate({
        onkeyup: false,
        rules:{
            deptName:{
                remote: {
                    url: "/system/post/checkPostNameUnique",
                    type: "post",
                    dataType: "json",
                    data: {
                        "deptName" : function() {
                            return $.common.trim($("#deptName").val());
                        }
                    },
                    dataFilter: function(data, type) {
                        return $.validate.unique(data);
                    }
                }
            },
            tyshxydm:{
                remote: {
                    url: ctx + "system/post/checkPostCodeUnique",
                    type: "post",
                    dataType: "json",
                    data: {
                        "tyshxydm" : function() {
                            return $.common.trim($("#tyshxydm").val());
                        }
                    },
                    dataFilter: function(data, type) {
                        return $.validate.unique(data);
                    }
                }
            },
            corpCode:{
                remote: {
                    url: ctx + "system/post/checkPostCodeUnique",
                    type: "post",
                    dataType: "json",
                    data: {
                        "corpCode" : function() {
                            return $.common.trim($("#corpCode").val());
                        }
                    },
                    dataFilter: function(data, type) {
                        return $.validate.unique(data);
                    }
                }
            },
        },
        messages: {
            "deptName": {
                remote: "企业名已经存在"
            },
            "tyshxydm": {
                remote: "统一社会信用代码已经存在"
            },
            "corpCode": {
                remote: "厂商码已经存在"
            }
        },
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/corp_add", $('#form-corp-add').serialize());
        }
    }
</script>
</body>
</html>